package com.hejing.自定义泛型类与泛型方法;

/**
 * ClassName: Order
 * Package: com.hejing.自定义泛型类与泛型方法
 * Description:
 *      泛型类
 *
 * @Author: HeJing
 * @Create: 2023-05-21 20:07
 * @Version: 1.0
 */
public class Order<T> {

    // 声明了类的泛型参数之后，就可以在类的内部使用此泛型参数
    private T t;

    private int orderId;

    // 构造器
    public Order() {
    }

    public Order(T t, int orderId) {
        this.t = t;
        this.orderId = orderId;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public void method01() {
        System.out.println("t: " + t);
    }
}


























